package com.sojson.project.controller.param.verify;

import java.math.BigDecimal;

import com.sojson.project.entity.po.OrderChild;
import com.sojson.result.Result;
import com.sojson.util.ArithUtil;
import com.sojson.util.StringUtil;

/**
 * 订单表参数验证
 * 
 * @author liu
 * @date 2021-03-16
 */
public class OrderChildParamVerify {

    /**
     * 退款(租赁)
     * 
     * @param order 订单
     * @return
     * @throws Exception 
     */
    public static Result<?> refundNew(OrderChild orderChild) {
        if (StringUtil.isBlankObject(orderChild.getOrderChildSn())) {
            return Result.fail("订单号不能为空！");
        }
        BigDecimal orderTotal = orderChild.getOrderTotal();
        if (StringUtil.isBlankObject(orderTotal)) {
            return Result.fail("订单金额不能为空！");
        }
        int intValue = orderTotal.intValue();
        if (intValue <= 0) {
            return Result.fail("订单金额必须大于0空！");
        }
        orderChild.setOrderTotal(ArithUtil.intPennyToBigDollar(intValue));

        return Result.success();
    }

}